package cn.wangliang181230.maven.plugins.mytest;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
 * SayHi Mojo
 */
@Mojo(name = "sayhi", defaultPhase = LifecyclePhase.CLEAN, threadSafe = true)
public class SayHiMojo extends AbstractMojo {

	@Parameter(property = "wl.mytest.skip", defaultValue = "false")
	private boolean skip;

	@Parameter(property = "wl.mytest.skip-sayhi", defaultValue = "false")
	private boolean skipSayHi;

	@Parameter(property = "wl.mytest.action", defaultValue = "${wl.mytest.default-action}")
	private String action;


	@Override
	public void execute() throws MojoExecutionException, MojoFailureException {
		if (skip || skipSayHi) {
			getLog().info("mytest-maven-plugin:sayhi are skipped.");
			return;
		}

		System.out.println("Hello World! action = " + action);
	}
}
